Skip to content

Extend SE050 simulator coverage for SE05x APIs - #19

Open
LinuxJedi wants to merge 2 commits into
wolfSSL:mainfrom
LinuxJedi:se05x-api-improvements
Open

Extend SE050 simulator coverage for SE05x APIs#19
LinuxJedi wants to merge 2 commits into
wolfSSL:mainfrom
LinuxJedi:se05x-api-improvements

Conversation

@LinuxJedi

@LinuxJedi LinuxJedi commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • extend SE050Sim policy, object, session, and SCP03 behavior for the updated wolfSSL SE05x APIs
  • support Platform SCP03 PUT KEY rotation and persistent key state
  • model policy-aware key insertion and generation, large/chunked object writes, RSA-4096, and EC curve provisioning
  • add raw-key attestation and freshness handling needed by Ed25519 and X25519 verification
  • add SDK and focused wolfCrypt regression coverage

Related: wolfSSL/wolfssl#11377

Testing

  • cargo test --all-targets -- --test-threads=1 (128 passed: 100 unit, 14 integration, 14 SCP03)
  • SE050 SDK test suite in plain mode (32/32 passed)
  • SE050 SDK test suite with SCP03 enabled (32/32 passed)
  • focused wolfCrypt Platform-SCP03/API regression test (passed)
  • git diff --check upstream/main...HEAD

Formatting note

cargo fmt --all -- --check is not clean on the current repository baseline; it reports repository-wide differences, including the local nxp-se050 path dependency.

Model the policy, object, session, attestation, and SCP03 behaviors needed by the improved wolfSSL SE05x APIs. Add SDK and end-to-end regression coverage for rotation, large objects, RSA-4096, lifecycle guards, and raw-key attestation.
Copilot AI lite review requested due to automatic review settings September 4, 2026 11:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes span protocol handling (SCP03/PUT KEY), persistence formats, and policy enforcement across multiple handlers, so it warrants final human review despite added tests.

Pull request overview

This PR extends the SE050 simulator to better match updated wolfSSL SE05x provisioning APIs by modeling object policies/origin metadata, adding Platform SCP03 key-rotation support via GlobalPlatform PUT KEY (with persistence), and expanding end-to-end regression coverage via new focused wolfCrypt + SDK tests.

Changes:

  • Add policy-aware object creation/overwrite/delete/read enforcement and implement ReadObjectAttributes reporting policy+origin.
  • Implement Platform SCP03 key rotation flow (SSD selection gating + PUT KEY parsing/unwrapping + persisted rotated key state).
  • Add/expand regression tests for the above behaviors (new wolfCrypt smoke test and an SDK test case).
File summaries
File Description
SE050Sim/wolfcrypt-test/test_api_improvements.c Adds an end-to-end smoke test covering SCP03 rotation, sessions, and policy-aware provisioning flows.
SE050Sim/se050-sim/src/t1.rs Tracks SSD selection state, routes INITIALIZE UPDATE with persisted SCP config, and intercepts PUT KEY inside SCP03.
SE050Sim/se050-sim/src/scp03/mod.rs Factors INITIALIZE UPDATE to allow injecting a stored SCP03 config.
SE050Sim/se050-sim/src/scp03/keys.rs Adds PUT KEY payload parsing, DEK unwrapping, KCV validation, and serialization support for persisted config.
SE050Sim/se050-sim/src/policy.rs Adds creation_policy() validation/copy helper plus explicit READ/WRITE/DELETE policy bits.
SE050Sim/se050-sim/src/object_store/types.rs Introduces persisted object metadata (policy + origin) with defaults.
SE050Sim/se050-sim/src/object_store/mod.rs Persists metadata and rotated platform SCP keysets; enforces policy checks via policy_allows().
SE050Sim/se050-sim/src/handlers/session.rs Adds SSD AID selection support and tightens SE050 AID matching.
SE050Sim/se050-sim/src/handlers/rsa.rs Enforces write-policy semantics while allowing multi-APDU RSA import staging; records creation metadata.
SE050Sim/se050-sim/src/handlers/object_mgmt.rs Enforces read/write/delete policy for objects, adds ReadObjectAttributes (v7 only), records creation metadata.
SE050Sim/se050-sim/src/handlers/ec.rs Enforces write-policy on EC key updates and records policy/origin metadata.
SE050Sim/se050-sim/src/handlers/aes.rs Enforces write-policy, records policy/origin, and refines empty-policy handling for HMAC derive-target.
SE050Sim/se050-sim/src/dispatch.rs Adds policy enforcement for RSA component reads through the crypto read path.
SE050Sim/se050-sim/src/apdu.rs Adds the P2_ATTRIBUTES constant for ReadObjectAttributes routing.
SE050Sim/sdk-test/test_se050.c Adds an SDK-level test validating immutable policy behavior and attributes reporting (v7.2+).
SE050Sim/README.md Updates documented feature set, test counts, and documents persisted PUT KEY / platform SCP behavior.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Require a host-supplied freshness challenge and verify object operations reject use after SE05x cleanup.
@LinuxJedi
LinuxJedi force-pushed the se05x-api-improvements branch from a07e7b0 to 11fc044 Compare September 4, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants